	
package com.mining.app.zxing.view;

import com.bier.fishproject.R;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class CustomProgressDialog extends Dialog {
	private Context context = null;
	private static CustomProgressDialog customProgressDialog = null;
	
	public CustomProgressDialog(Context context){
		super(context);
		this.context = context;
	}
	
	public CustomProgressDialog(Context context, int theme) {
        super(context, theme);
    }
	
	@SuppressLint("NewApi") public static CustomProgressDialog createDialog(Context context,String text){
		
		customProgressDialog = new CustomProgressDialog(context,R.style.loading_dialog);
		customProgressDialog.setContentView(R.layout.loading_dialog);
		customProgressDialog.getWindow().getAttributes().gravity = Gravity.CENTER;
		customProgressDialog.setCanceledOnTouchOutside(true);
		
		ImageView imageView = (ImageView) customProgressDialog.findViewById(R.id.img);
		LinearLayout lin=(LinearLayout)customProgressDialog.findViewById(R.id.dialog_view);
		lin.setBackground(context.getResources().getDrawable(R.drawable.shape));
        Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(context, R.anim.loading_animation); 
        imageView.startAnimation(hyperspaceJumpAnimation); 
		TextView tv=(TextView)customProgressDialog.findViewById(R.id.tv_dialog);
		tv.setText(text);
		return customProgressDialog;
	}
 
}

